package com.jk.entity.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class ModelController {

public static void main(String[] args) throws Exception{

    Dept  dept = new Dept();
    dept.setDeptno(111);
    dept.setDname("杨浩");
    dept.setLoc("小哲");

    System.out.println("dept对象:"+dept);

    String stringDept = JSON.toJSONString(dept);

    System.out.println("dept的Json："+ stringDept);

    //将json转化为对象
    Dept aDetp = JSONObject.toJavaObject(JSONObject.parseObject(stringDept), Dept.class);

    System.out.println("dept对象："+ aDetp);

    }

}
